The scheme used by TCL to implement pop-up menus and/or custom MDEFs is incompatible with Suitcase for font menus. The changes described below will make TCL pop-up and/or custom-MDEF font menus compatible with Suitcase and should have no adverse affects nor introduce incompatibilities with anything else. Note that there is no compatibility problem except for font menus which are pop-up menus or which have a custom MDEF that you develop or both.
Summary: TCL installs an MDEF "hook" that assumes that no other software (such as Suitcase) will also install such a hook after TCL's hook is installed. The changes below remove reliance on that assumption.
These changes are specified with respect to TCL 1.1.3, but the same or very similar changes should be applicable to earlier versions.
I. Font popup menus.
If you want to use TCL’s "hook" feature which widens pop-up menus to acommodate a down-arrow, you can make the following changes for Suitcase compatibility if you have pop-up font menus. (If you don't want the hook feature you can just remove the #define __INSTALL_MENU_HOOK__ in CStdPopupPane.cp, in which case the following changes are not required. Regardless, if you have a font menu with a custom MDEF, see the second section of this document.)
In CStdPopupPane.h, change struct tMenuHook's first field from
short jmp;
to
short bsr;
and add the following additional field at the end of the struct:
long hookCode[3];
In the CStdPopupPane.cp, change the definition near the top of the file from:
static pascal void MenuProc( short message, MenuHandle menu, Rect *menuRect,
Point hitPt, short *whichItem);
to add a new final argument as follows:
static pascal void MenuProc( short message, MenuHandle menu, Rect *menuRect,
Point hitPt, short *whichItem,
Handle realMenuProc);
Change three code lines in CStdPopupPane::HookMenu from:
Change the MenuProc function at the end of the source file as follows:
Add a new final argument:
static pascal void MenuProc( short message, MenuHandle menu, Rect *menuRect,
Point hitPt, short *whichItem, Handle realMenuProc)
Remove these two lines:
tMenuHookHndl menuHook;
Handle realMenuProc;
and remove these two lines:
menuHook = (tMenuHookHndl) (**menu).menuProc;
realMenuProc = (**menuHook).realMenuProc;
You might also want to change a comment in the file regarding the source of the "hook" logic — do a Find on "technique".
II. Font menus with custom MDEFs.
(1) TCL documentation (THINK Class Library Guide Version 6, p. 318) says that your MDEF resource should be 10 bytes long with the following contents (hex):
4EF9 0000 0000 0000 0000
Instead, make it 22 bytes long with the following contents (hex):
(For a disassembly of this code, see the comments in the suggested changes to CStdPopupPane::HookMenu in Part I above.)
(2) Alter GenericMDEF.h and GenericMDEF.cp (or .c if you're using a THINK C earlier than 6.0) to add the following additional argument as the last argument to GenericMDEF (it will follow the previously last argument, whichItem):
CMenuDefProc *theMenuDefProc
Alter the definition of GenericMDEF in GenericMDEF.cp (or .c) to remove the declarations of the two local variables theMDEF and theMenuDefProc (the latter is now an argument to the function per the preceding paragraph), and to remove the first two assignment statements. In sum, after the change, GenericMDEF will take an additional argument (which was formerly a local variable), have no local variables, and execute only a switch statement.